home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / rpg / crossfir.92 / crossfir / crossfire-0.92.5 / include / structs.h < prev    next >
C/C++ Source or Header  |  1996-07-24  |  35KB  |  827 lines

  1. /*
  2.  * static char *rcsid_structs_h =
  3.  *   "$Id: structs.h,v 1.52 1996/07/24 07:18:06 master Exp master $";
  4.  */
  5.  
  6. /*
  7.     CrossFire, A Multiplayer game for X-windows
  8.  
  9.     Copyright (C) 1994 Mark Wedel
  10.     Copyright (C) 1992 Frank Tore Johansen
  11.  
  12.     This program is free software; you can redistribute it and/or modify
  13.     it under the terms of the GNU General Public License as published by
  14.     the Free Software Foundation; either version 2 of the License, or
  15.     (at your option) any later version.
  16.  
  17.     This program is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.     GNU General Public License for more details.
  21.  
  22.     You should have received a copy of the GNU General Public License
  23.     along with this program; if not, write to the Free Software
  24.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26.     The author can be reached via e-mail to master@rahul.net
  27. */
  28.  
  29. #ifndef STRUCTS_H
  30. #define STRUCTS_H
  31.  
  32. /* Type defines for specific signed/unsigned variables of a certain number
  33.  * of bits.  Not really used anyplace, but if a certain number of bits
  34.  * is required, these type defines should then be used.  This will make
  35.  * porting to systems that have different sized data types easier.
  36.  *
  37.  * Note: The type defines should just mean that the data type has at
  38.  * least that many bits.  if a uint16 is actually 32 bits, no big deal,
  39.  * it is just a waste of space.
  40.  *
  41.  * Note2:  When using something that is normally stored in a character
  42.  * (ie strings), don't use the uint8/sint8 typdefs, use 'char' instead.
  43.  * The signedness for char is probably not universal, and using char
  44.  * will probably be more portable than sint8/unit8
  45.  */
  46.  
  47. typedef unsigned int    uint32;
  48. typedef signed int    sint32;
  49. typedef unsigned short    uint16;
  50. typedef signed short    sint16;
  51. typedef unsigned char    uint8;
  52. typedef signed char    sint8;
  53.  
  54. typedef struct sockets {
  55.   struct sockets *next;
  56.   int fd;
  57.   int listen_lev;
  58.   int protocol;        /* Set by protocol command            */
  59.   char name[9];        /* Username on remote side, terminated by '\0'    */
  60.   char host[17];    /* 129.250.82.2 format, terminated by '\0'    */
  61.   LogLevel debug;    /* If 0, no debug will be written (not even errors) */
  62.   unsigned wiz:1;    /* If true, privilegied command can be done    */
  63.   unsigned use_pix:1;    /* If true, use pixmaps when adding player      */
  64.   unsigned color_pix:1;    /* If true, use color pixmaps when adding player */
  65.   unsigned split:1;    /* If true, use split windows when adding player*/
  66.   unsigned quit:1;    /* If true, the socket will be closed, and exit */
  67.   int sync;        /* Ticks between each sync.  1 = always, 0 = never */
  68. } sockets;
  69.  
  70. typedef struct liv { /* Mostly used by "alive" objects */
  71.   sint8        Str,Dex,Con,Wis,Cha,Int,Pow;
  72.   sint8        wc,ac;        /* Weapon Class and Armour Class */
  73.   sint16    hp;        /* Hit Points. */
  74.   sint16    maxhp;
  75.   sint16    sp;        /* Spell points.  Used to cast mage spells. */
  76.   sint16    maxsp;        /* Max spell points. */
  77.   sint16    grace;        /* Grace.  Used to invoke clerical prayers. */
  78.   sint16    maxgrace;    /* Grace.  Used to invoke clerical prayers. */
  79.   sint32    exp;        /* Experience.  Killers gain 1/10. */
  80.   sint16    food;        /* How much food in stomach.  0 = starved. */
  81.   sint16    dam;        /* How much damage this object does when hitting */
  82.   sint8        luck;        /* Affects thaco and ac from time to time */
  83. } living;
  84.  
  85.  
  86. /* New face structure - this enforces the notion that data is face by
  87.  * face only - you can not change the color of an item - you need to instead
  88.  * create a new face with that color.
  89.  */
  90. typedef struct new_face_struct {
  91.     uint16    number;        /* This is the image id.  IT should be the */
  92.                 /* same value as its position in the array */
  93.     uint8    fg, bg;
  94.     char    *name;
  95.     uint8    visibility;
  96. } New_Face;
  97.  
  98. typedef struct map_look_struct {
  99.     New_Face *face;
  100.     uint8    flags;
  101. } MapLook;
  102.  
  103. typedef struct obj {
  104. /* These variables are not changed by copy_object(): */
  105.   struct pl *contr;    /* Pointer to the player which control this object */
  106.   struct obj *next;    /* Pointer to the next object in the free/used list */
  107.   struct obj *prev;    /* Pointer to the previous object in the free/used list*/
  108.   struct obj *active_next;    /* Next & previous object in the 'active' */
  109.   struct obj *active_prev;    /* List.  This is used in process_events */
  110.                 /* so that the entire object list does not */
  111.                 /* need to be gone through. */
  112.   struct obj *below;   /* Pointer to the object stacked below this one */
  113.   struct obj *above;   /* Pointer to the object stacked above this one */
  114.              /* Note: stacked in the *same* environment*/
  115.   struct obj *inv;     /* Pointer to the first object in the inventory */
  116.   struct obj *container; /* Current container being used.  I think this
  117.               * is only used by the player right now.
  118.               */
  119.   struct obj *env;     /* Pointer to the object which is the environment.
  120.             * This is typically the container that the object is in.
  121.             */
  122.   struct obj *more;    /* Pointer to the rest of a large body of objects */
  123.   struct obj *head;    /* Points to the main object of a large body */
  124.   struct mapdef *map;  /* Pointer to the map in which this object is present */
  125.  
  126.   uint32    count;         /* Which nr. of object created this is. */
  127.   uint16    refcount;    /* How many objects points to this object */
  128.   struct oblnk *sk_list;    /* Pointer to linked list of skill objects for this ob*/
  129.  
  130. /* These get an extra add_refcount(), after having been copied by memcpy() */
  131.   char *name;            /* The name of the object, obviously... */
  132.   char *title;            /* Of foo, etc */
  133.   char *race;            /* human, goblin, dragon, etc */
  134.   char *slaying;        /* Which race to do double damage to */
  135.   char *msg;            /* If this is a book/sign/magic mouth/etc */
  136.                 /* If this is an exit, this is the filename */
  137. /* These variables are copied by memcpy() in copy_object(): */
  138.   sint16 x,y;            /* Position in the map for this object */
  139.   sint16 ox,oy;            /* For debugging: Where it was last inserted */
  140.   float speed;                  /* The overall speed of this object */
  141.   float speed_left;             /* How much speed is left to spend this round */
  142.   uint32    nrof;        /* How many of the objects */
  143.   New_Face *face;        /* Face with colors */
  144.   sint8        direction;    /* Means the object is moving that way. */
  145.   sint8 facing;            /* Object is oriented/facing that way. */
  146.   uint8 type;                 /* PLAYER, BULLET, etc.  See define.h */
  147.   /* The next 6 variables actually only really use 24 bits each */
  148.   uint32    immune;        /* Attacks which the object is immune against */
  149.   uint32    protected;    /* Attacks which does half damage */
  150.   uint32    attacktype;    /* Same bitmask as immune/protected */
  151.   uint32    vulnerable;    /* Attacks which does double damage */
  152.   uint32    path_attuned;    /* Paths the object is attuned to */
  153.   uint32    path_repelled;    /* Paths the object is repelled from */
  154.   uint32    path_denied;     /* Paths the object is denied access to */
  155.   uint16    material;          /* What materials this object consist of */
  156.   sint8        magic;        /* Any magical bonuses to this item */
  157.   sint8        thrownthaco;    /* How precise the throw is */
  158.   uint8        state;          /* How the object was last drawn (animation) */
  159.   sint32    value;        /* How much money it is worth (or contains) */
  160.   signed short level;
  161.   signed short last_heal;       /* Last healed. Depends on constitution */
  162.   signed short last_sp;         /* As last_heal, but for spell points */
  163.   signed short last_grace;      /* as last_sp, except for grace */
  164.   signed short last_eat;    /* How long since we last ate */
  165.   signed short invisible;    /* How much longer the object will be invis */
  166.   sint8        armour;        /* How many % is subtracted from phys. damage */
  167.   unsigned char pick_up;        /* See crossfire.doc */
  168.   struct obj *owner;  /* Pointer to the object which controls this one */
  169.                       /* Owner should not be referred to directly - */
  170.                       /* get_owner should be used instead. */
  171.   struct obj *enemy;   /* Monster/player to follow even if not closest */
  172.   struct archt *arch;           /* Pointer to archetype */
  173.   struct archt *other_arch;    /* Pointer used for various things */
  174.   signed long weight;           /* Attributes of the object */
  175.   signed long carrying;         /* How much weight this object contains */
  176.   uint32 flags[3];        /* various flags */
  177.   unsigned short ownercount;    /* What count the owner had (in case owner */
  178.                 /* has been freed) */
  179. #if 0
  180.   unsigned short thrown;        /* How much further the object will fly */
  181. #endif
  182. /* Some debug variables: */
  183.   unsigned short run_away;    /* Monster runs away if it's hp goes below \
  184.                    this percentage. */
  185. #ifdef NPC_PROG
  186.   unsigned short npc_status;    /* What the NPC is doing right now */
  187.   unsigned short npc_program;    /* Helps find out what the NPC will do next */
  188. #endif
  189.  
  190. /* Not commented out by ALLOW_SKILLS - to many pieces of code want this
  191.  * information
  192.  */
  193.   struct obj *chosen_skill;    /* the skill chosen to use */
  194.   struct obj *exp_obj;        /* the exp. obj (category) assoc. w/ this object */
  195.   uint32 hide;            /* The object is hidden, not invisible */
  196.  
  197. /* lighting code uses these - b.t. */
  198.   struct oblnk *lights;       /* list of lights the object carries */
  199.   signed short glow_radius;    /* indicates the glow radius of the object */
  200.  
  201. /* changes made by kholland@sunlab.cit.cornell.edu */
  202. /* allows different movement patterns for attackers */
  203.   signed long move_status;      /* What stage in attack mode */
  204.   unsigned short move_type;     /* What kind of attack movement */
  205.  
  206.   signed long weight_limit;     /* Weight-limit of object */
  207.   unsigned char can_apply;      /* See crossfire.doc */
  208.   unsigned char will_apply;     /* See crossfire.doc */
  209.   unsigned char anim_speed, last_anim; /* ticks between animation-frames */
  210.   living stats;
  211.  
  212. #ifdef CASTING_TIME
  213.   signed short casting;         /* time left before spell goes off */
  214.   struct spell_struct *spell;
  215.   unsigned int spelltype;
  216.   unsigned short spell_state;
  217.   unsigned short start_holding;
  218.   char *spellarg;
  219. #endif
  220.  
  221. /* This modification will allow variable experience requirements 
  222.    for advancement (eanders@cmu.edu) */
  223.   double expmul;        /* needed experience = (calc_exp*expmul) */
  224. } object;
  225.  
  226. typedef struct oblnk { /* Used to link together several objects */
  227.   object *ob;
  228.   struct oblnk *next;
  229.   int id;
  230. } objectlink;
  231.  
  232. typedef struct oblinkpt { /* Used to link together several object links */
  233.   struct oblnk *link;
  234.   long value;        /* Used as connected value in buttons/gates */
  235.   struct oblinkpt *next;
  236. } oblinkpt;
  237.  
  238. /*
  239.  * So far only used when dealing with artifacts.
  240.  * (now used by alchemy and other code too. Nov 95 b.t).
  241.  */
  242. typedef struct linked_char {
  243.   char *name;
  244.   struct linked_char *next;
  245. } linked_char;
  246.  
  247. /* 'recipe' and 'recipelist' are used by the alchemy code */
  248. typedef struct recipestruct {
  249.         char *title;      /* distinguishing name of product */
  250.         char *arch_name;   /* the archetype of the final product made */
  251.         int chance;       /* chance that recipe for this item will appear
  252.                            * in an alchemical grimore */
  253.     int index;      /* an index value derived from formula ingredients */
  254.     int transmute;      /* if defined, one of the formula ingredients is
  255.                * used as the basis for the product object */
  256.         linked_char *ingred;    /* comma delimited list of ingredients */
  257.         struct recipestruct *next;
  258. } recipe;
  259.  
  260. typedef struct recipeliststruct {
  261.         int total_chance;
  262.         int number;            /* number of recipes in this list */ 
  263.         struct recipestruct *items;    /* pointer to first recipe in this list */ 
  264.     struct recipeliststruct *next;     /* pointer to next recipe list */ 
  265. } recipelist;
  266.  
  267. /*
  268.  * An obwin structure contains a window with scrollbar, where the user
  269.  * can click on items and move the scrollbar.
  270.  */
  271.  
  272. typedef struct obwinstruct {
  273.   unsigned inventory:1;    /* True, if it's an inventory */
  274.   int x,y;        /* If it's not an inventory, this is the coordinates */
  275.   struct mapdef *map;    /* If it's not an inventory, this is the map */
  276.   object *ob;        /* If it is an inventory, this is the environment */
  277.   char format[16];    /* sprintf-format for text (object-names/weight) */
  278.   Window win;
  279.   GC gc_text,gc_icon;
  280.   XSizeHints hint;
  281.   signed short chars;        /* How wide the text-field is */
  282.   signed short scroll;        /* How many items scrolled down */
  283.   signed short last_scroll;    /* Where it was when last drawn */
  284.   signed short nrofdrawn;    /* How many items drawn.  Delete extras */
  285.   unsigned short barlength;    /* Height of scrollbar in pixels */
  286.   signed short size;        /* How many items there is room to display */
  287.   Fontindex *faces;        /* [size] */
  288.   char **names;            /* [size][chars+1] */
  289.   unsigned short scrollsize;    /* How large the last drawn scrollbar was */
  290.   unsigned short scrollstart;    /* Where the scrollbar starts */
  291. } obwin;
  292.  
  293. /*
  294.  * I'll clean up the player structure before v1.0 release...
  295.  * Yeah, I know, it's really messy now...
  296. */
  297.  
  298. #ifdef SAVE_WINDOW_POSITIONS   /* structure for storing window sizes */
  299. typedef struct {
  300.   int x,y;                     /* window x,y to parent */
  301.   int wx,wy;                   /* window x,y to root */
  302.   unsigned int w,h;
  303. } save_win_pos;
  304. #endif /* SAVE_WINDOW_POSITIONS */
  305.  
  306. #define KEYF_DEFAULT    0x01    /* Default bind */
  307. #define KEYF_USER    0x02    /* User defined */
  308. #define KEYF_WIZ    0x04    /* Wizard only command */
  309. #define KEYF_NORMAL    0x08    /* Used in normal mode */
  310. #define KEYF_FIRE    0x10    /* Used in fire mode */
  311. #define KEYF_RUN    0x20    /* Used in run mode */
  312. #define KEYF_EDIT    0x40    /* Line editor */
  313.  
  314. typedef int (*CommFunc)(object *op, char *params);
  315.  
  316. typedef struct __Key_s {    /* player's structure */
  317.   unsigned char flags;
  318.   KeyCode keycode;
  319.   KeySym keysym;
  320.   CommFunc func;
  321.   char *params;
  322.   struct __Key_s *next;
  323. } Key_s;
  324.  
  325. typedef struct {        /* global list's structure */
  326.   char *name;
  327.   CommFunc func;
  328.   float    time;            /* How long it takes to execute this command */
  329. } CommArray_s;
  330.  
  331. #define NUM_OUTPUT_BUFS    5
  332. typedef struct {
  333.   char *buf;            /* Actual string pointer */
  334.   uint32 first_update;        /* First time this message was stored  */
  335.   uint16 count;            /* How many times we got this message */
  336. } Output_Buf;
  337.  
  338.  
  339. typedef enum inventory_show {
  340.   show_all = 0, show_applied = 1, show_unapplied = 2, show_unpaid = 3,
  341.   show_cursed = 4, show_magical = 5, show_nonmagical = 6
  342. } inventory_show;
  343.  
  344. typedef enum rangetype {
  345.   range_bottom = -1, range_none = 0, range_bow = 1, range_magic = 2,
  346.   range_wand = 3, range_rod = 4, range_scroll = 5, range_horn = 6,
  347.   range_skill = 7,
  348. #ifdef ALLOW_SKILLS
  349.   range_size = 8
  350. #else
  351.   range_size = 7
  352. #endif
  353. } rangetype;
  354.  
  355. typedef struct pl {
  356.   struct pl *next;          /* Pointer to next player, NULL if this is last */
  357.   char maplevel[MAX_BUF];     /* On which level is the player? */
  358.   struct mapdef *loading;     /* When entering a map in progress of loading */
  359.   int new_x,new_y;            /* After entering a map being loaded */
  360.   int removed;                /* Flag telling if ob is to be inserted */
  361.   int key_state;              /* 1=define push key, 2=define directions */
  362.   sint16 known_spells[NROFREALSPELLS]; /* Spells known by the player */
  363.   uint16 nrofknownspells;     /* Index in the above array */
  364.   unsigned known_spell:1;     /* True if you know the spell of the wand */
  365.   unsigned last_known_spell:1;/* What was last updated with draw_stats() */
  366.   rangetype shoottype;          /* Which range-attack is being used by player */
  367.   rangetype last_shoot;          /* What was last updated with draw_stats() */
  368.   sint16 chosen_spell;        /* Type of readied spell */
  369.   sint16 last_spell;        /* What spell draw_stats() last displayed */
  370.   sint16 chosen_item_spell;    /* Type of spell that the item fires */
  371.   uint32 count;       /* Any numbers typed before a command */
  372.   uint32 count_left;  /* How many instances of prev_cmd are left */
  373.                   /* to execute */
  374.   unsigned char prev_cmd;     /* Previous command executed */
  375.   unsigned char prev_fire_on;
  376.   unsigned char prev_keycode; /* Previous command executed */
  377.   unsigned char key_down;     /* Last move-key still held down */
  378.   KeySym prev_keysym;          /* Previous command executed */
  379.   uint16 mode;            /* Mode of player for pickup. */
  380.   signed char digestion;      /* Any bonuses/penalties to digestion */
  381.   signed char gen_hp;         /* Bonuses to regeneration speed of hp */
  382.   signed char gen_sp;         /* Bonuses to regeneration speed of sp */
  383.   signed char gen_grace;      /* Bonuses to regeneration speed of grace */
  384.   uint8 berzerk;      /* Affects usage of CTRL-direction */
  385.   uint32 split_window:1;    /* info-window will be separate */
  386.   uint32 braced:1;          /* Will not move if braced, only attack */
  387.   uint32 tmp_invis:1;       /* Will invis go away when we attack ? */
  388.   uint32 do_los:1;          /* If true, update_los() in draw(), and clear */
  389. #ifdef EXPLORE_MODE
  390.   uint32 explore:1;         /* if True, player is in explore mode */
  391. #endif
  392.   uint32 infofull:1;        /* True if info structure has been fileed up */
  393.   uint32 keyboard_flush:1;    /* True if keyboard events should be flushed each time */
  394.   uint32 show_inv_icon:1;    /* True if we should show the inv. icons */
  395.   unsigned char state,infoline,infopos;
  396.   unsigned char writing;   /* When true, the player is writing text */
  397.              /* to be displayed */
  398.   unsigned char listening; /* Which priority will be used in info_all */
  399.  
  400.   unsigned char fire_on;
  401.   unsigned char run_on;
  402.   unsigned char idle;      /* How long this player has been idle */
  403.   unsigned char has_hit;   /* If set, weapon_sp instead of speed will count */
  404.   float weapon_sp;         /* Penalties to speed when fighting w speed >ws/10*/
  405.   float last_weapon_sp;    /* Last turn */
  406.   signed char last_armour; /* Last turn */
  407.  
  408.   object *menu;        /* list of shop objects for inventory */
  409. #ifdef OBWIN
  410.   obwin *inv,*look;        /* Inventory and look windows */
  411. #else
  412.   inventory_show show_what;      /* Only show applied items in inventory */
  413.   signed short scroll_inv;      /* How many items we have scrolled down */
  414.   signed short scroll_look;       /* The same, but for the look-window */
  415.   signed short last_scroll_inv;   /* where it was when last drawn */
  416.   signed short last_scroll_look;  /* ditto for look-window */
  417.   signed short nrofdrawn_inv;      /* How many items drawn. Delete extras */
  418.   signed short nrofdrawn_look;    /* ditto for the look-window */
  419.   signed short inv_chars;         /* How wide the text-field is */
  420.   sint16 look_chars;            /* How wide the text-field is */
  421.   char format_inv[16];            /* printf-format for text in inv. window */
  422.   char format_look[16];           /* printf-format for text in look window */
  423.   unsigned short barlength_inv;   /* height of scrollbar in pixels */
  424.   unsigned short barlength_look;  /* ditto, for the look-window */
  425.   signed short inv_size;          /* How many items are displayed */
  426.   signed short look_size;         /* Ditto, for the look-window */
  427.   unsigned short scrollsize_inv;  /* How large the last drawn scrollbar was */
  428.   unsigned short scrollsize_look; /* How large the last drawn scrollbar was */
  429.   unsigned short scrollstart_inv; /* Where the scrollbar starts */
  430.   unsigned short scrollstart_look;/* ditto */
  431. #endif
  432.   unsigned short scrollsize_hp;   /* How large the last scrollbar was */
  433.   unsigned short scrollhp_alert;  /* Was the last scrollbar red */
  434.   unsigned short scrollsize_sp;   /* How large the last scrollbar was */
  435.   unsigned short scrollsp_alert;  /* Was the last scrollbar red */
  436.   unsigned short scrollsize_grace;  /* How large was the last scrollbar */
  437.   unsigned short scrollgrace_alert;  /* Was the last scrollbar red */
  438.   unsigned short scrollsize_food; /* How large the last scrollbar was */
  439.   unsigned short scrollfood_alert;  /* Was the last scrollbar red */
  440.   short shootstrength;     /* Strength of spell */
  441.   object *golem;           /* Which golem is controlled */
  442.   living orig_stats;       /* Can be less in case of poisoning */
  443.   living last_stats;       /* Last stats drawn with draw_stats() */
  444.   float last_speed;
  445.   signed long last_value;  /* Same usage as last_stats */
  446.   long last_weight;
  447. /* These are used for avoiding to draw the same thing twice: */
  448.   Fontindex look_face[MAX_LOOK_SIZE];
  449.   Fontindex inv_face[MAX_INV_SIZE];
  450.  
  451.   /* CF 0.91.4:  look_name and inv_name are only really used to determine if
  452.    * the objects name/weight should be redrawn.  So instead of
  453.    * allocating fixed storage, we use add_string and free_string
  454.    * instead.  For the inventory, the name returned by query_name
  455.    * is stored.  This is because if we use the formatted name
  456.    * (like what is used for the look_name array), the various icons
  457.    * will not be updated properly.
  458.    */
  459.   char *look_name[MAX_LOOK_SIZE]; /* Lots of space wasted, must fix */
  460.   char *inv_name[MAX_INV_SIZE];   /* this in the future... */
  461.   char font_str[255];
  462.   uint32 freeze_look:1;         /* To avoid drawing sometimes */
  463.   uint32    freeze_inv:1;
  464.   int viewmap; /* Locks any map-drawings */
  465.   int mapres;  /* resolution of drawn map */
  466.   int mapxmin, mapymin; /* min x and y drawn in map view */
  467. /* Pixels to be erazed */
  468.   int mapdelx[32],mapdely[32];
  469. #ifdef USE_SWAP_STATS
  470.   int Swap_First;
  471. #endif
  472.   
  473.   Display *gdisp;
  474. /* Should be kept here so that all windows can use it... */
  475.   Pixmap pixmap;    /* Used when windows are iconified */
  476.   Pixmap *pixmaps;    /* Contains the font in pixmap-format (if needed) */
  477.   Pixmap *masks;    /* Contains the bitmasks for the pixmaps -- */
  478.             /* Right now only used with the color Pixmaps (XPM) */
  479.   Pixmap xpm_pixmap;    /* Object drawn on this, and then copied onto
  480.              * game window.
  481.              */
  482.  
  483.   int use_pixmaps;    /* If set, use pixmaps instead of fonts */
  484.   int color_pixmaps;    /* if set, use color pixmaps (XPM) */
  485.   XEvent gevent;
  486.   KeySym gkey;
  487.   Window win_root,win_game,win_stats,win_info,win_inv,win_look,win_message;
  488.   GC gc_root,gc_game,gc_stats,gc_info,gc_inv_text,gc_inv_icon,
  489.   gc_look_text,gc_look_icon,gc_message, gc_xpm_floor, gc_xpm_object;
  490.   GC gc_inv_status_icon;
  491.   XSizeHints gamehint,stathint,roothint,infohint,invhint,lookhint,messagehint;
  492.   long gscreen;
  493.   unsigned long gforeground,gbackground;
  494.   Font font, game_font;
  495.   object *ob;            /* The object representing the player */
  496.   object *last_used;     /* Pointer to object last picked or applied */
  497.   long last_used_id;     /* Safety measures to be sure it's the same */
  498.   New_Face *drawn[WINRIGHT-WINLEFT+1][WINLOWER-WINUPPER+1]; /* Last displayed */
  499. #ifdef Xpm_Pix
  500.   /* Floor the player is standing on */
  501.   New_Face *floor[WINRIGHT-WINLEFT+1][WINLOWER-WINUPPER+1];
  502. #ifdef DOUBLE_FLOOR
  503.   New_Face *floor2[WINRIGHT-WINLEFT+1][WINLOWER-WINUPPER+1];
  504. #endif
  505. #endif
  506.   sint8 blocked_los[WINRIGHT-WINLEFT+1][WINLOWER-WINUPPER+1];
  507.   char *name;        /* What display the player has */
  508.   char *username;     /* Username supplied by client */
  509.   char title[MAX_NAME];
  510.   
  511. /* Eneq(@csd.uu.se): Since there is no direct link between characters title and
  512.    his level I figure that it doesn't matter what title he has so I have made
  513.    it possible for him/her to define this in the resources. */
  514.   
  515.   char own_title[MAX_NAME];
  516.   
  517.   signed char levhp[11]; /* What the player gained on that level */
  518.   signed char levsp[11];
  519.   signed char levgrace[11];
  520.   signed char last_level;
  521.  
  522.  
  523.   KeySym commandkeysym, firekeysym[2], runkeysym[2];
  524.   KeyCode commandkey, firekey[2], runkey[2];
  525.   Key_s *keys[COMMAND_HASH_SIZE];
  526.    
  527.   char no_echo;           /* If true, the player is typing a password. */
  528.   uint32 name_changed:1;      /* If true, the player has set a name. */
  529.   char killer[BIG_NAME];  /* Who killed this player. */
  530.   char last_cmd;
  531.   Colormap colormap;
  532.   int peaceful;
  533.   XColor discolor[NUM_COLORS];
  534.   int iscolor:1;
  535.  
  536.   char scroll;        /* Will the text-window scroll or wrap? */
  537.   char write_buf[MAX_BUF];
  538.   char **info;
  539.   unsigned char infolines,infochars; /* How big the info-array is */
  540.   char password[16]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */
  541. #ifdef SAVE_INTERVAL
  542.   time_t last_save_time;
  543. #endif /* SAVE_INTERVAL */
  544. #ifdef AUTOSAVE
  545.   long last_save_tick;
  546. #endif
  547. #ifdef SIMPLE_PARTY_SYSTEM
  548.   short party_number;
  549.   short party_number_to_join; /* used when player wants to join a party
  550.                  but we will have to get password first
  551.                  so we have to remember which party to
  552.                  join */
  553. #endif /* SIMPLE_PARTY_SYSTEM */
  554. #ifdef SAVE_WINDOW_POSITIONS
  555.   short valid_save_positions;
  556.   save_win_pos win_pos[6];
  557. #endif
  558. #ifdef SOUND_EFFECTS
  559.   int rplay_fd;    /* Connexion with the rplayd daemon (disabled if <= 0) */
  560.   int play_count;  /* Counter to avoid sound-lag */
  561. #endif
  562. #ifdef SEARCH_ITEMS
  563.   char search_str[MAX_BUF];
  564. #endif /* SEARCH_ITEMS */
  565.   int sync;    /* Ticks between each sync.  1 = always, 0 = never */
  566.   int cur_sync;    /* Counter from 1 to sync */
  567.  
  568. #ifdef SPELL_ENCUMBRANCE
  569.   short encumbrance;  /*  How much our player is encumbered  */
  570. #endif
  571.   uint32 eric_server;
  572.   Output_Buf    outputs[NUM_OUTPUT_BUFS];
  573.   uint16    outputs_sync;    /* How often to print, no matter what */
  574.   uint16    outputs_count;    /* Print if this count is exceeded */
  575. } player;
  576.   
  577. /*
  578.  * The score structure is used when treating new high-scores
  579.  */
  580.  
  581. typedef struct scr {
  582.   char name[BIG_NAME];      /* name + title */
  583.   char killer[BIG_NAME];    /* name (+ title) or "quit" */
  584.   long exp;                 /* Experience */
  585.   char maplevel[BIG_NAME];  /* Killed on what level */
  586.   int maxhp,maxsp;          /* Max hp and sp when killed */
  587.   int position;             /* Position in the highscore list */
  588. } score;
  589.  
  590. /*
  591.  * When parsing a message-struct, the msglang struct is used
  592.  * to contain the values.
  593.  * This struct will be expanded as new features are added.
  594.  * When things are stable, it will be parsed only once.
  595.  */
  596.  
  597. typedef struct _msglang {
  598.   char **messages;    /* An array of messages */
  599.   char ***keywords;    /* For each message, an array of strings to match */
  600. } msglang;
  601.  
  602. /*
  603.  * The mapstruct is allocated each time a new map is opened.
  604.  * It contains pointers (very indirectly) to all objects on the map.
  605.  */
  606.  
  607. #define mapx map_object->x
  608. #define mapy map_object->y
  609.  
  610. typedef struct mapdef {
  611.   struct mapdef *next;    /* Next map, linked list */
  612.   object *where;    /* What object were used to enter this map */
  613.   char path[MAX_BUF];    /* Filename of the map */
  614.   char *tmpname;    /* Name of temporary file */
  615.   long reset_time;    /* When < sec since 1970, load original instead */
  616.   sint32 timeout;        /* When it reaches 0, the map will be swapped out */
  617.   uint32 need_refresh:1;    /* Something went wrong, need sanity check */
  618. #if defined(UNIQUE_ITEMS) && defined(LOCK_ITEMS)
  619.   sint32 lock_items;       /* The number of lockfile or 0 if not locked */
  620. #endif
  621.   sint16 players;        /* How many plares are on this level right now */
  622.   uint32 in_memory;    /* If not true, the map has been freed and must
  623.                  * be loaded before used.  The map,omap and map_ob
  624.                  * arrays will be allocated when the map is loaded */
  625.   uint32 encounter:1;    /* True if this is a randomly generated map */
  626.   uint8 compressed;  /* Compression method used */
  627.   MapLook *map;
  628.   MapLook *floor;
  629. #ifdef DOUBLE_FLOOR  
  630.   MapLook *floor2;
  631. #endif
  632.   object **map_ob;    /* What object lies on the floor */
  633.   uint16 difficulty;    /* What level the player should be to play here */
  634.   objectlink *pending;  /* Objects waiting for the map to be loaded */
  635.  
  636.   /* lighting code uses these */
  637.   uint32 do_los:1;    /* True if line of sight needs to be recalculated for 
  638.                  * players on this map*/
  639.   uint8 darkness;        /* indicates level of darkness of map */
  640.   objectlink *light;    /* linked list of lights (type object) in map */
  641.  
  642.   object *map_object;   /* Map object in new map format */
  643.   oblinkpt *buttons;    /* Linked list of linked lists of buttons */
  644. } mapstruct;
  645.  
  646. /*
  647.  * The archetype structure is a set of rules on how to generate and manipulate
  648.  * objects which point to archetypes.
  649.  */
  650.  
  651. typedef struct archt {
  652.   char *name;           /* More definite name, like "generate_kobold" */
  653.   struct archt *next;    /* Next archetype in a linked list */
  654.   struct archt *head;   /* The main part of a linked object */
  655.   struct archt *more; /* Next part of a linked object */
  656.   struct treasureliststruct *randomitems; /* Items to be generated */
  657.   object clone;        /* An object from which to do copy_object() */
  658.   unsigned long editable;         /* editable flags (mainly for editor) */
  659.   long used_by;        /* A count of how many objects use this archetype */
  660.   unsigned char animations;        /* How many different faces to animate */
  661.   Fontindex *faces;     /* The different animations */
  662.   char *arch_pointer;   /* Did this archetype deviate from another? */
  663. } archetype;
  664.  
  665. /*
  666.  * treasure is one element in a linked list, which together consist of a
  667.  * complete treasure-list.  Any arch can point to a treasure-list
  668.  * to get generated standard treasure when an archetype of that type
  669.  * is generated (from a generator)
  670. */
  671.  
  672. typedef struct treasurestruct {
  673.   struct archt *item;            /* Which item this link can be */
  674.   char *name;                /* If non null, name of list to use
  675.                        instead */
  676.   struct treasurestruct *next;        /* Next treasure-item in a linked list */
  677.   struct treasurestruct *next_yes;  /* If this item was generated, use */
  678.                     /* this link instead of ->next */
  679.   struct treasurestruct *next_no;   /* If this item was not generated, */
  680.                     /* then continue here */
  681.   uint8 chance;                /* Percent chance for this item */
  682.   uint8 magic;                /* Max magic bonus to item */
  683.                     /* If the entry is a list transition,
  684.                      * 'magic' contains the difficulty
  685.                      * required to go to the new list
  686.                       */
  687.   uint16 nrof;                /* random 1 to nrof items are generated */
  688. } treasure;
  689.  
  690. typedef struct treasureliststruct {
  691.   char *name;                /* Usually monster-name/combination */
  692.   sint16 total_chance;            /* If non-zero, only 1 item on this
  693.                      * list should be generated.  The
  694.                      * total_chance contains the sum of
  695.                      * the chance for this list.
  696.                      */
  697.   struct treasureliststruct *next;    /* Next treasure-item in linked list */
  698.   struct treasurestruct *items;        /* Items in this list, linked */
  699. } treasurelist;
  700.  
  701.  
  702. typedef enum SpellTypeFrom {
  703.   spellNormal, spellWand, spellRod, spellHorn, spellScroll, spellPotion
  704. } SpellTypeFrom;
  705.  
  706. typedef struct races_struct {
  707.   struct races *next;    /* next race in linked list */
  708.   char *category;       /* Name of race category */
  709.   char *creature[8];   /* creatures in category */
  710. } races;
  711.  
  712. typedef struct god_struct {
  713.   char *name;               /* how to describe the god to the player */
  714.   char *enemy;             /* name of the opposing god */ 
  715.   unsigned int attacktype;    /* Favored attack of the god, usually AT_FEAR */ 
  716.   unsigned int immune;          /* Attacks which the god's priest may be immune */
  717.   unsigned int protected;       /* Attacks which do half damage to the priest */
  718.   unsigned int vulnerable;      /* Attacks which do double damage to the priest */
  719.   uint32 path_attuned;          /* Paths the god's priest is attuned to */
  720.   uint32 path_repelled;         /* Paths the god's priest is repelled from */
  721.   uint32 path_denied;           /* Paths the gods's priest is denied access to */
  722.   char *aligned_race;        /* names of races of creatures aligned w/ the god */ 
  723.   char *enemy_race;        /* names of races of "enemy" creatures */ 
  724.   char *desc;            /* comma delimited list of short descriptive terms */ 
  725. } god; 
  726.  
  727. typedef struct skill_struct {
  728.       char *name;       /* how to describe it to the player */
  729.       short category;   /* the experience category to which this skill belongs */
  730.       short time;       /* base number of ticks it takes to use the skill */
  731.       long bexp;        /* base exp gain for this skill */
  732.       float lexp;       /* level multiplier of exp gain for using this skill */
  733.       short stat1;      /* primary stat effecting use of this skill */
  734.       short stat2;      /* secondary stat for this skill */
  735.       short stat3;      /* tertiary stat for this skill */
  736. } skill;
  737.  
  738.  
  739. typedef struct spell_struct {
  740.   char name[BIG_NAME];
  741.   short level;           /* Level required to cast this spell */
  742.   short sp;              /* Spellpoint-cost to cast it */
  743.   short charges;         /* If it can be used in wands, max # of charges */
  744.   float time;            /* How many ticks it takes to cast the spell */
  745.   short scrolls;         /* If it can be used from scrolls, max # of scrolls */
  746.   short scroll_chance;   /* 1-10 probability of finding this as scroll */
  747.   short books;           /* 1-10 probability of finding this as spellbook */
  748.   unsigned range:1;      /* True if this is a range attack spell */
  749.   unsigned defensive:1;  /* True if it is a defensive spell */
  750.   unsigned cleric:1;     /* True if it is a cleric-spell (wis-chance failure)*/
  751.   unsigned onself:1;     /* Should monsters cast this spell on themselves */
  752.   uint32 path;           /* Path this spell belongs to */
  753.   char *archname;     /* Pointer to archetype used by spell */
  754. } spell;
  755.  
  756. typedef struct
  757. {
  758.   sint16 bdam;  /*  base damage  */
  759.   sint16 bdur;  /*  base duration  */
  760.   sint16 ldam;  /*  damage adjustment for level  */
  761.   sint16 ldur;  /*  duration adjustment for level  */
  762.   sint16 spl;
  763. } spell_parameters;
  764.  
  765. typedef struct att_msg_str {
  766.   char *msg1;
  767.   char *msg2;
  768. } att_msg;
  769.  
  770. typedef struct artifactstruct {
  771.     object    *item;
  772.     uint16    chance;
  773.     uint8    difficulty;
  774.     struct artifactstruct *next;
  775.     linked_char *allowed;
  776. } artifact;
  777.  
  778. typedef struct artifactliststruct {
  779.     uint8    type;        /* Object type that this list represents */
  780.     uint16    total_chance;    /* sum of chance for are artifacts on this list */
  781.     struct artifactliststruct *next;
  782.     struct artifactstruct *items;
  783. } artifactlist;
  784.  
  785. /* Always define this structure - some prototypes in sproto.h use this
  786.  * structure, and errors will result if the SIMPLE_PARTY_SYSTEM is not
  787.  * selected.  Keeping it defined doesn't really harm anything anyways.
  788.  */
  789. /*#ifdef SIMPLE_PARTY_SYSTEM*/
  790.  
  791. typedef struct party_struct {
  792.   sint16 partyid;
  793.   char * partyleader;
  794.   char passwd[9];
  795.   struct party_struct *next;
  796.   char *partyname;
  797. } partylist;
  798.  
  799. /*#endif *//* SIMPLE_PARTY_SYSTEM */
  800. /*
  801.  * Used in shstr.c, libproto.h necessitates this dummy. For the real
  802.  * contents of a shared_string, look in shstr.h
  803.  */
  804. typedef int shared_string;
  805.  
  806. /*
  807.  * Some function types
  808.  */
  809. typedef void (*type_func_int)(int);
  810. typedef void (*type_func_int_int)(int,int);
  811. typedef void (*type_func_void)(void);
  812. typedef void (*type_func_map)(mapstruct *);
  813. typedef void (*type_func_map_char)(mapstruct *, char *);
  814. typedef void (*type_func_int_map_char)(int, mapstruct *, char *);
  815. typedef void (*type_func_ob)(object *);
  816. typedef void (*type_func_ob_char)(object *, char *);
  817. typedef void (*type_func_ob_cchar)(object *, const char *);
  818. typedef void (*type_func_int_int_ob_cchar)(int, int, object *, const char *);
  819. typedef void (*type_func_ob_ob)(object *, object *);
  820. typedef void (*type_func_ob_int)(object *, int);
  821. typedef int (*type_int_func_ob_ob)(object *, object *);
  822. typedef void (*type_func_char_int)(char *, int);
  823. typedef void (*type_func_int_ob_ob)(int, object *, object *);
  824.  
  825. #endif /* STRUCTS_H */
  826.  
  827.